<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>综合2</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        .box {
            display: flex;
            /* justify-content: space-evenly; */
            flex-wrap: wrap;
            margin: 0 auto;
            width: 525px;
        }

        .pic {
            width: 100px;
            height: 100px;
            /* margin-bottom: 5px; */
            margin: 0 5px 5px 0;
            border: 3px solid skyblue;
            border-radius: 10px 0 10px 0;
            /* background-image: url(./images/1.webp); */
        }
    </style>
</head>

<body>
    <div class="box">
        <!-- <div class="pic" style="background-image: url(./images/1.webp);"></div>
        <div class="pic"></div>
        <div class="pic"></div>
        <div class="pic"></div>
        <div class="pic"></div>
        <div class="pic"></div>
        <div class="pic"></div>
        <div class="pic"></div>
        <div class="pic"></div>
        <div class="pic"></div> -->
        <script>
            let arr = [
                './images/1.webp',
                './images/2.webp',
                './images/3.webp',
                './images/4.webp',
                './images/5.webp',
                './images/6.webp',
                './images/7.webp',
                './images/8.webp',
                './images/9.webp',
                './images/10.webp',
                './images/11.webp',
                './images/12.webp',
                './images/13.webp',
                './images/14.webp',
                './images/15.webp',
                './images/16.webp',
                './images/17.webp',
                './images/18.webp',
                './images/19.webp',
                './images/20.webp'
            ]
            let num = prompt('请输入1~20之前的英雄个数')
            let str = ''
            for (let i = 0; i < num; i++) {
                str += (`
                <div class="pic" style="background-image: url(${arr[i]});"></div>
                `)
            }
            document.write(str)
        </script>
    </div>
</body>

</html>